package svc

import (
	"2103A-server/house/internal/config"
	"2103A-server/house/internal/model"
	"github.com/zeromicro/go-zero/core/stores/sqlx"
)

type ServiceContext struct {
	Config     config.Config
	HouseModel model.HouseModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	// 连接数据库
	conn := sqlx.NewMysql(c.Mysql.Datasource)

	return &ServiceContext{
		Config:     c,
		HouseModel: model.NewHouseModel(conn),
	}
}
